-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix quantal stdp test for numpy #681
Fix quantal stdp test for numpy #681
Conversation
1e3cf60
to
84b1252
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mschmidt87 Please do not change the travis.yml file in this PR. I will comment on this in the issue, but it is a separate issue and requires careful consideration. I also added some small suggestions to the test.
vm.shape = (n_trials, t_tot) | ||
vm_reference.shape = (n_trials, t_tot) | ||
vm.shape = (n_trials, int(t_tot)) | ||
vm_reference.shape = (n_trials, int(t_tot)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using int(t_tot)
here to dimension the result array is not a good idea, since you implicitly require that the voltmeter records at 1 ms intervals. A cleaner implementation would be (not 100% sure of spelling of assertions)
self.assert_equal(len(vm) % n_trials, 0)
n_steps = int(len(vm) / n_trials) # int to be absolutely Py3-safe
vm.shape = (n_trials, n_steps)
...
vm.shape = (n_trials, t_tot) | ||
vm_reference.shape = (n_trials, t_tot) | ||
vm.shape = (n_trials, int(t_tot)) | ||
vm_reference.shape = (n_trials, int(t_tot)) | ||
|
||
vm_mean = numpy.array([numpy.mean(vm[:, i]) | ||
for i in range(int(t_tot))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can avoid the list comprehension here, NumPy supports row- and column-wise means.
Convert float variables to integers when using them as indices to numpy arrays and make reshaping of voltmeter more general
84b1252
to
c4dfd24
Compare
Thank you for your feedback. I removed the commit touching .travis.yml from the PR and addressed your comments. I furthermore removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
This pull request addresses #680 and contains the following changes:
t_tot
had been implemented in this test at a different location earlier.